home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.n / regsub.n < prev    next >
Text File  |  1995-07-25  |  5KB  |  133 lines

  1.  
  2.  
  3.  
  4.      rrrreeeeggggssssuuuubbbb((((nnnn))))                    TTTTccccllll (((( ))))                    rrrreeeeggggssssuuuubbbb((((nnnn))))
  5.  
  6.  
  7.  
  8.      _________________________________________________________________
  9.  
  10.      NNNNAAAAMMMMEEEE
  11.           regsub - Perform substitutions based on  regular  expression
  12.           pattern matching
  13.  
  14.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  15.           rrrreeeeggggssssuuuubbbb ?_s_w_i_t_c_h_e_s? _e_x_p _s_t_r_i_n_g _s_u_b_S_p_e_c _v_a_r_N_a_m_e
  16.      _________________________________________________________________
  17.  
  18.  
  19.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  20.           This command matches  the  regular  expression  _e_x_p  against
  21.           _s_t_r_i_n_g,  and  it copies _s_t_r_i_n_g to the variable whose name is  |
  22.           given by _v_a_r_N_a_m_e.  The command returns 1 if there is a match  |
  23.           and  0  if  there  isn't.   If  there is a match, then while  |
  24.           copying _s_t_r_i_n_g to _v_a_r_N_a_m_e the portion of _s_t_r_i_n_g that matched
  25.           _e_x_p  is  replaced with _s_u_b_S_p_e_c.  If _s_u_b_S_p_e_c contains a ``&''
  26.           or ``\0'', then it is replaced in the substitution with  the
  27.           portion  of  _s_t_r_i_n_g that matched _e_x_p.  If _s_u_b_S_p_e_c contains a
  28.           ``\_n'', where _n is a digit between  1  and  9,  then  it  is
  29.           replaced in the substitution with the portion of _s_t_r_i_n_g that
  30.           matched  the  _n-th  parenthesized  subexpression   of   _e_x_p.
  31.           Additional  backslashes  may  be  used in _s_u_b_S_p_e_c to prevent
  32.           special interpretation of  ``&''  or  ``\0''  or  ``\_n''  or
  33.           backslash.   The  use  of  backslashes  in  _s_u_b_S_p_e_c tends to
  34.           interact badly with the Tcl parser's use of backslashes,  so
  35.           it's  generally  safest  to  enclose _s_u_b_S_p_e_c in braces if it
  36.           includes backslashes.
  37.  
  38.           If the initial arguments to rrrreeeeggggeeeexxxxpppp start with  ----  then  they  |
  39.           are   treated  as  switches.   The  following  switches  are  |
  40.           currently supported:                                          |
  41.  
  42.           ----aaaallllllll                                                               ||
  43.                     All  ranges in _s_t_r_i_n_g that match _e_x_p are found and  |
  44.                     substitution  is  performed  for  each  of   these  |
  45.                     ranges.    Without  this  switch  only  the  first  |
  46.                     matching range is found and substituted.  If  ----aaaallllllll  |
  47.                     is  specified, then ``&'' and ``\_n'' sequences are  |
  48.                     handled   for   each   substitution   using    the  |
  49.                     information from the corresponding match.           |
  50.  
  51.           ----nnnnooooccccaaaasssseeee                                                            ||
  52.                     Upper-case  characters in _s_t_r_i_n_g will be converted  |
  53.                     to  lower-case  before   matching   against   _e_x_p;  |
  54.                     however,  substitutions  specified  by _s_u_b_S_p_e_c use  |
  55.                     the original unconverted form of _s_t_r_i_n_g.            |
  56.  
  57.           --------                                                                 ||
  58.                     Marks the end of switches.  The argument following  |
  59.                     this one will be treated as _e_x_p even if it  starts  |
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 7/17/95)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      rrrreeeeggggssssuuuubbbb((((nnnn))))                    TTTTccccllll (((( ))))                    rrrreeeeggggssssuuuubbbb((((nnnn))))
  71.  
  72.  
  73.  
  74.                     with a ----....
  75.  
  76.           See  the  manual  entry  for  rrrreeeeggggeeeexxxxpppp  for  details  on   the
  77.           interpretation of regular expressions.
  78.  
  79.  
  80.      KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
  81.           match, pattern, regular expression, substitute
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 7/17/95)
  130.  
  131.  
  132.  
  133.